Learn R Programming

corrfuns (version 1.2)

Asymptotic p-value for many correlation coefficients: Asymptotic p-value for many correlation coefficients

Description

Asymptotic p-value for many correlation coefficients.

Usage

correls(y, x, type = "pearson", rho = 0, alpha = 0.05)

Value

A matrix with 5 columns, the correlations, the test statistics, their associated p-values and the relevant \((1-\alpha)\%\) confidence intervals.

Arguments

y

A numerical vector.

x

A numerical vector.

type

The type of correlation coefficient to compute, "pearson" or "spearman".

rho

The hypothesized value of the true partial correlation.

alpha

The significance level.

Author

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Details

Suppose you have a (dependent) variable \(Y\) and a matrix of \(p\) variables \(\bf X\) and you want to get all the correlations between \(Y\) and \(X_i\) for \(i=1,\ldots,p\). if you type cor(y, x) in you will get a vector of the correlations. What I offer here is confidence interval for each of the correlations, the test statistic and the p-values for the hypothesis that each of them is equal to some value \(\rho\). The p-values and test statistics are useful for meta-analysis for example, combination of the p-values in one or even to see the false discovery rate (see the package fdrtool by Korbinian Strimmer).

See Also

correl, permcorrels

Examples

Run this code
y <- rnorm(40)
x <- matrix(rnorm(40 * 1000), ncol = 1000)
a <- correls(y, x )

Run the code above in your browser using DataLab